﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace SC2Ranks
{
    [DataContract]
    public class TeamInfo
    { 
        [DataMember(Name = "losses")]
        public int Losses { get; set; }

        [DataMember(Name = "is_random")]
        public bool IsRandom { get; set; }

        [DataMember(Name = "division")]
        public string Division { get; set; }

        [DataMember(Name = "ratio")]
        public double Ratio { get; set; }

        [DataMember(Name = "division_id", IsRequired = false)]
        public int DivisionID { get; set; }

        [DataMember(Name = "bracket")]
        public int Bracket { get; set; }

        [DataMember(Name = "league")]
        protected string LeagueRaw { get; set; }

        public League League { get { return Helper.ParseLeague(LeagueRaw); } }

        [DataMember(Name = "points")]
        public int Points { get; set; }

        [DataMember(Name = "division_rank")]
        public int DivisionRank { get; set; }

        [DataMember(Name = "wins")]
        public int Wins { get; set; }

        [DataMember(Name = "members", IsRequired = false)]
        public TeamMateInfo[] Members { get; set; }
    }

    [DataContract]
    public class PlayerTeamInfo : TeamInfo
    {
        [DataMember(Name = "region_rank")]
        public int RegionRank { get; set; }

        [DataMember(Name = "fav_race")]
        protected string FavoriteRaceRaw { get; set; }

        public Race FavoriteRace { get { return Helper.ParseRace(FavoriteRaceRaw); } }

        [DataMember(Name = "world_rank")]
        public int WorldRank { get; set; }

        [DataMember(Name = "id", IsRequired = false)]
        public int ID { get; set; }
    }
}
